package com.zhentao.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhentao.common.Result;
import com.zhentao.domain.SysSite;
import com.zhentao.domain.dto.PageDto;
import com.zhentao.service.SysSiteService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName: SysSiteControler
 * @Desrciption: Mr.chengfenzhan
 * @Author: 知安_程烽展
 * @Date: 2024/9/3 20:08
 */
@RestController
@RequestMapping("/syssite")
@Tag(name = "站点管理")
public class SysSiteControler {
    @Autowired
    private SysSiteService sysSiteService;
    @GetMapping("/data")
    @Operation(summary = "获取站点数据")
    public Result getData()
    {
        return sysSiteService.getData();
    }
    @GetMapping("/byName")
    @Operation(summary = "根据站点名称查询站点信息")
    public Result getByName(String name)
    {
        return sysSiteService.getByName(name);
    }

    @PostMapping("/page")
    @Operation(summary = "分页查询站点信息")
    public Result<Page<SysSite>> getSitePage(@RequestBody PageDto pageDto){
        return sysSiteService.getSitePage(pageDto);
    }
    @GetMapping("/remove/{id}")
    @Operation(summary = "删除站点信息")
    public Result remove(@PathVariable("id") Integer id){
        return sysSiteService.removeSite(id);
    }
    @PostMapping("/save")
    @Operation(summary = "新增站点信息")
    public Result SaveSite(@RequestBody SysSite sysSite){
        return sysSiteService.SaveSite(sysSite);
    }
    @PostMapping("/update")
    @Operation(summary = "修改站点信息")
    public Result updateSite(@RequestBody SysSite sysSite){
        return sysSiteService.updateSite(sysSite);
    }
}
